﻿using System.IO;

namespace AlipaySDK
{
    public class AopConfig
    {
        public static string alipay_public_key = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Pem\\alipay_rsa_public_key.pem";
        //这里要配置没有经过PKCS8转换的原始私钥
        public static string merchant_private_key = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Pem\\rsa_private_key.pem";
        public static string merchant_public_key = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Pem\\rsa_public_key.pem";
        public static string charset = "GBK";
        public static string serverUrl = "https://openapi.alipay.com/gateway.do";

         public AopConfig()
        {
            //
            // TODO: Add constructor logic here
            //

        }

         public static string getMerchantPublicKeyStr()
         {
             StreamReader sr = new StreamReader(merchant_public_key);
             string pubkey = sr.ReadToEnd();
             sr.Close();
             if (pubkey != null)
             {
                 pubkey = pubkey.Replace("-----BEGIN PUBLIC KEY-----", "");
                 pubkey = pubkey.Replace("-----END PUBLIC KEY-----", "");
                 pubkey = pubkey.Replace("\r", "");
                 pubkey = pubkey.Replace("\n", "");
             }
             return pubkey;
         }
    }
}
